Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum





XML - JavaScript Transformation question
~George Minkrozenjip 01/22/2004 05:12 PM
Domino Designer All Releases All Platforms


Hi,

I'm trying to transform a xml page to display documents on the web. I'm using example from the Sandbox (Acme Auto Parts). I changed the reference to display my page and my stylesheet, but it's always values from acme database that are showing??? can't figured out... here is my code :

//Defines HTMLresults as a variable
var HTMLresults;
//Defines source as a variable
var source;
//Defines style as a variable
var style;

//Defines loadXML() as a function
function loadXML() {
//Creates a new ActiveXObject called source which is the Microsoft.XMLDOM parser that is part of IE 5.5
source = new ActiveXObject("Microsoft.XMLDOM");
//Creates a new ActiveXObject called style which is the Microsoft.XMLDOM parser that is part of IE 5.5
style = new ActiveXObject("Microsoft.XMLDOM");

source.async = false;
style.async = false;
//Sets the validateOnParse property to false
source.validateOnParse = false;

//Loads the GetParts page into the parser using the openPage URL command
source.load("http://localhost/XMLOrders.nsf/CategoryList?openPage");
//Loads the acmepartscatalog.xsl stylesheet into the parser using the openPage URL command
style.load("http://localhost/XMLOrders.nsf/categorylist.xsl?OpenPage");
//Error handler. If there is an error, call the showError() function
if(source.parseError.errorCode != 0) {
showError();
}
//If there is no error, call the doTransform() function
doTransform();
}

//Defines doTransform() as a function
function doTransform() {
//If the getReadyState() function returns true, then transform the node using the stylesheet and put the results into the tags with the HTMLresults attribute.
if (getReadyState()){
resulting = source.transformNode(style);
document.all.item("HTMLresults").innerHTML = resulting;
}
//If the getReadyState() function doesn't return true, then refresh.
self.refresh;
}

//Defines the getReadyState function
function getReadyState() {
// alert("ready state: " + source.readyState);
if (source.readyState == 4) {
return true;
}
setTimeout("getReadyState()", 100);
}


//Defines the showError() function
function showError() {
var strError = new String;
var err = source.parseError;
strError = 'Error!\n' +
'file url: '+err.url +' \n'+
'line no.:'+err.line +'\n'+
'char: '+ err.linepos + '\n' +
'source: '+err.srcText+'\n'+
'code: '+err.errorCode+'\n'+
'description: '+err.reason+'\n';
document.all.item("HTMLresults").innerHTML = strError;
}

Someone can help me? Why is it always loading wrong stylesheet and documents???
Thanks in advance,
Genevieve

Go back